<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta content="en" name="language">
	<title>colormap</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link media="screen" href="../docutils-api.css" type="text/css" rel="stylesheet">

</head>

<body>

<div class="banner">
<img src="../images/gm-107x76.png" alt="GraphicMagick logo" width="107" height="76" />
<span class="title">GraphicsMagick</span>
<form action="http://www.google.com/search">
  <input type="hidden" name="domains" value="www.graphicsmagick.org" />
  <input type="hidden" name="sitesearch" value="www.graphicsmagick.org" />
<span class="nowrap"><input type="text" name="q" size="25" maxlength="255" />&nbsp;<input type="submit" name="sa" value="Search" /></span>
</form>
</div>


<div class="navmenu">
<ul>
  <li><a href="../index.html">Home</a></li>
  <li><a href="../project.html">Project</a></li>
  <li><a href="../download.html">Download</a></li>
  <li><a href="../README.html">Install</a></li>
  <li><a href="../Hg.html">Source</a></li>
  <li><a href="../NEWS.html">News</a> </li>
  <li><a href="../utilities.html">Utilities</a></li>
  <li><a href="../programming.html">Programming</a></li>
  <li><a href="../reference.html">Reference</a></li>
</ul>
</div>

<main id="colormap">
<h1 class="title">colormap</h1>
<p class="subtitle" id="colormap-related-functions">Colormap related functions</p>
<div class="contents topic" id="contents">
<p class="topic-title">Contents</p>
<ul class="simple">
<li><p><a class="reference internal" href="#allocateimagecolormap" id="id5">AllocateImageColormap</a></p></li>
<li><p><a class="reference internal" href="#cyclecolormapimage" id="id6">CycleColormapImage</a></p></li>
<li><p><a class="reference internal" href="#replaceimagecolormap" id="id7">ReplaceImageColormap</a></p></li>
</ul>
</div>
<section id="allocateimagecolormap">
<h1><a class="toc-backref" href="#id5">AllocateImageColormap</a></h1>
<section id="synopsis">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail AllocateImageColormap( <a class="reference external" href="../api/types.html#image">Image</a> *image, const unsigned long colors );</pre>
</section>
<section id="description">
<h2>Description</h2>
<p>AllocateImageColormap() allocates an image colormap and initializes
it to a linear gray colorspace with increasing intensity.  If the image
already has a colormap, it is replaced.  AllocateImageColormap() returns
MagickPass if successful, otherwise MagickFail if there is not enough memory.</p>
<p>The format of the AllocateImageColormap method is:</p>
<pre class="literal-block">MagickPassFail AllocateImageColormap( <a class="reference external" href="../api/types.html#image">Image</a> *image, const unsigned long colors );</pre>
<dl class="simple">
<dt>image:</dt>
<dd><p>The image.</p>
</dd>
<dt>colors:</dt>
<dd><p>The number of colors in the image colormap.</p>
</dd>
</dl>
</section>
</section>
<section id="cyclecolormapimage">
<h1><a class="toc-backref" href="#id6">CycleColormapImage</a></h1>
<section id="id1">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail CycleColormapImage( <a class="reference external" href="../api/types.html#image">Image</a> *image, const int amount );</pre>
</section>
<section id="id2">
<h2>Description</h2>
<p>CycleColormap() displaces an image's colormap by a given number of
positions.  If you cycle the colormap a number of times you can produce
a psychodelic effect.</p>
<p>The format of the CycleColormapImage method is:</p>
<pre class="literal-block">MagickPassFail CycleColormapImage( <a class="reference external" href="../api/types.html#image">Image</a> *image, const int amount );</pre>
<p>A description of each parameter follows:</p>
<dl class="simple">
<dt>image:</dt>
<dd><p>The image.</p>
</dd>
<dt>amount:</dt>
<dd><p>Offset the colormap this much.</p>
</dd>
</dl>
</section>
</section>
<section id="replaceimagecolormap">
<h1><a class="toc-backref" href="#id7">ReplaceImageColormap</a></h1>
<section id="id3">
<h2>Synopsis</h2>
<pre class="literal-block">MagickPassFail ReplaceImageColormap( <a class="reference external" href="../api/types.html#image">Image</a> *image, const <a class="reference external" href="../api/types.html#pixelpacket">PixelPacket</a> *colormap,
                                     const unsigned int colors );</pre>
</section>
<section id="id4">
<h2>Description</h2>
<p>ReplaceImageColormap() replaces an existing image colormap with a new
image colormap. The new image colormap is expected to contain all of the
colors from the existing colormap. The existing colormap indexes are
adjusted to conform with positions in the new colormap. If the new
colormap contains duplicate entries, then the associated colormap index
will point to the first entry found in the colormap and other matching
entries will not be used. MagickPass is returned if the operation is
successful, otherwise MagickFail is returned, and image-&gt;exception is
updated with the cause of the failure.</p>
<p>This function is useful in case colormap entries need to match across
multiple images or otherwise occupy specific locations.</p>
<p>The format of the ReplaceImageColormap method is:</p>
<pre class="literal-block">MagickPassFail ReplaceImageColormap( <a class="reference external" href="../api/types.html#image">Image</a> *image, const <a class="reference external" href="../api/types.html#pixelpacket">PixelPacket</a> *colormap,
                                     const unsigned int colors );</pre>
<dl class="simple">
<dt>image:</dt>
<dd><p>image in which to replace colormap.</p>
</dd>
<dt>colormap:</dt>
<dd><p>new colormap.</p>
</dd>
<dt>colors:</dt>
<dd><p>number of colors in new colormap.</p>
</dd>
</dl>
</section>
</section>
</main>


<hr class="docutils">
<div class="document">
    <p><a href="../Copyright.html">Copyright</a> © GraphicsMagick Group 2002-2025<!--SPONSOR_LOGO--></p>
</div>

</main>
</body>
</html>
